int GegReg()
{
 int i,RCost,MiniCost=9999;
 for(i=0;i<16;i++)
 {
  RCost=FreeRegCost(i);
  if(RCost<MiniCost)
  {
   MiniCost=RCost;
   
  }
 }
}
int VarCost(int r,Reg_State *p)
{
  if(p->DL==0)
  {
   if(p->SNS==0)
	{
	 delet_item(r,p);
	 return 0;
	}
	else
	{
	  delet_item(r,p);
	  return 0;
	}
  
  }
  else
  {
    if(p->SNS==0)
	{
	 return 2;
	}
	else
	{
	  return 4;
	}
  }
}

int FreeReg(int r)
{
  int RCost=0;
  if(reg_stack[r]!=NULL)
  {
    Reg_State *p=reg_stack[r]->next;
	while(p!=NULL)
	{
	 RCost=Rcost+VarCost(r,p);
	}
  }
  return RCost;
}